/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once

#include "IEntity.h"

/**
=======================
Base class for a weapon
=======================
*/
class IWeapon : public IEntity
{
public:
    IWeapon(void);

    /** Get the Entity Type */
    virtual int GetType() { return TYPE_WEAPON; };

    /** Apply Common Dictionary Attributes */
    ///void Apply();

    /** Update */
    virtual void Update(long deltaTime);

    /** Fire this weapon */
    virtual void Fire();

    /** Reload this weapon */
    virtual void Reload();

    /** Collide with this weapon */
    virtual bool CollideWith( IEntity *ent );

    /** Weapon is Ready */
    bool IsReady();
    /** Weapon is Firing */
    bool IsFiring();
    /** Weapon is reloading */
    bool IsReloading();

    /** Item is Idle, on the ground */
    bool CanPickUp();

    /** Get the owner of this weapon */
    IEntity* GetOwner() { return m_owner; };
    /** Set the owner of this weapon */
    void SetOwner(IEntity* owner) { m_owner = owner; };
protected:
    /** Check for reload */
    void CheckAutoReload();

    // how long it takes to fire
    float   m_weaponTime;
    // how long it takes to reload
    float   m_reloadTime;

    // owner of this weapon
    IEntity*    m_owner;

    // Weapon hit collision bounds
    Rect        m_hitBounds;

public:
    virtual ~IWeapon(void);
};
